//
//  SERegistrationDoctorFooterView.swift
//  SmartEyeForPatient
//
//  Created by qdsg on 2021/4/21.
//

import UIKit

protocol SERegistrationDoctorFooterViewDelegate: NSObjectProtocol {
    func registrationDoctorFooterViewArrowBtnAction(section: Int)
}

class SERegistrationDoctorFooterView: UIView {


    @IBOutlet weak var arrowBtn: UIButton!

    @IBAction func arrowBtnAction(_ sender: UIButton) {
        delegate?.registrationDoctorFooterViewArrowBtnAction(section: section)
    }

    weak var delegate: SERegistrationDoctorFooterViewDelegate?
    var section: Int = 0

    override init(frame: CGRect) {
        super.init(frame: frame)
        loadNib()
    }

    required init?(coder: NSCoder) {
        super.init(coder: coder)
        loadNib()
    }

    func updateView(model: SERegistrationDoctorModel, section: Int) {
        self.section = section
        arrowBtn.isSelected = model.isOpen
    }

    func loadNib() {
        let view = UINib.init(nibName: String(describing: type(of: self)), bundle: nil).instantiate(withOwner: self, options: nil).last as! UIView
        view.frame = bounds
        addSubview(view)
    }

}
